<?php

namespace HuoShu\UI;

class Filter{
    public function member_account_status($current=0){
        $txt="<select name='status'>";
        
        $data=array("0"=>"选择状态","1"=>"试玩","2"=>"正常","3"=>"冻结");
        
        foreach($data as $k=>$v){
            $select='';
            if($current==$k){
                $select=' selected ';
            }
            $txt.="<option value='$k' $select >$v</option>";
        }
        
        $txt.="</select>";
        
        return $txt;
    }
    
    public function select_common($data,$name,$current){
        $txt="<select name='$name'>";
        
        $txt.="<option value='0' >请选择</option>";
        foreach($data as $k=>$v){
            $select='';
            if($current==$k){
                $select=' selected ';
            }
            $txt.="<option value='$k' $select >$v</option>";
        }
        
        $txt.="</select>";
        
        return $txt;
        
    }
    
    public function app_select(){
        $apps=M('game')->getField("id,name",true);
        $app_select=$this->select_common($apps,"app_id",$_GET['app_id']);
        return $app_select;
    }
    
    public function agent_select(){
        $where=array();
        $where['user_type']='7';
        $data=M('users')->where($where)->getField("id,user_nicename",true);
        $select=$this->select_common($data,"agent_id",$_GET['agent_id']);
        return $select;
    }
    
     public function agent_select2(){
        $where=array();
        $where['_string']='user_type=7 or user_type=6';
        $data=M('users')->where($where)->getField("id,user_login",true);
        $select=$this->select_common($data,"agent_id",$_GET['agent_id']);
        return $select;
    }
    
    public function member_select(){
        $where=array();
        $data=M('members')->where($where)->getField("id,username",true);
        $select=$this->select_common($data,"mem_id",$_GET['mem_id']);
        return $select;
    }
    
    public function time_choose($start_time='',$end_time=''){
        if(!$start_time){
            $s_v=$_GET['start_time'];
        }
        if(!$end_time){
            $e_v=$_GET['end_time'];
        }
       $txt='<input type="text" name="start_time" class="js-date" value="'.$s_v.'" 
                    placeholder="开始时间..." style="width: 110px;" autocomplete="off">-
             <input type="text" class="js-date" name="end_time" value="'.$e_v.'" 
                    placeholder="结束时间..." style="width: 110px;" autocomplete="off">';
       
       return $txt;
    }
    
    public function payway_select(){
        $data=array("1"=>"自然",
            "2"=>"非自然",
            "3"=>"支付宝",
            "4"=>"微信",
            "5"=>"网银",
            "6"=>"平台币",
            "7"=>"游戏币"
            );
        $select=$this->select_common($data,"payway",$_GET['payway']);
        return $select;
    }
    
    public function agent_level_select(){
        $data=array(
            "6"=>"一级",
            "7"=>"二级"
            );
        $select=$this->select_common($data,"user_type",$_GET['user_type']);
        return $select;
    }
}

